package br.com.revolution.util;

public class StringUtils {

	public static final String WHITE_SPACE = " ";
	
	public static final String MP3_EXTENSION = ".mp3";
	
	public static String capitalize(String value) {
		if (value != null  && !value.equals("")) {
			String newValue = new String();
			String[] values = value.trim().split(WHITE_SPACE);
			
			for (String name : values) {
				char chars[] = name.toCharArray();
				chars[0] = Character.toUpperCase(chars[0]);
				newValue += new String(chars) + " ";
			}
			
			return newValue.trim();
		}
		
		return value;
	}

	public static String createMp3FileName(String trackNumberOnAlbum,
			String leadArtist, String songTitle) {
		
		StringBuilder sb = new StringBuilder();
		sb.append(trackNumberOnAlbum);
		sb.append(" - ");
		sb.append(leadArtist);
		sb.append(" - ");
		sb.append(songTitle);
		sb.append(MP3_EXTENSION);
		
		return sb.toString();
	}

}
